package com.bandi.tharshesnows.model;

public enum SkirunStatus {

  OPEN("deschisa"), OPEN_OPTIMAL("se schiaza in conditii optime"), OPEN_DIFFICULT("se schiaza in conditii dificile"), OPEN_GOOD(
      "se schiaza in conditii bune"), OPEN_ACCEPTABLE("se schiaza in conditii acceptabile"), CLOSED("inchisa"), CLOSED_TECHNICAL(
      "inchisa tehnic"), CLOSED_BAD_WEATHER("conditii_meteo_nefavorabile"), CLOSED_AVALANCHE("pericol de avalansa");

  private String text;

  private SkirunStatus(String text) {
    this.text = text;
  }

  public String getText() {
    return text;
  };

  public static SkirunStatus parse(String string) {
    if (string.equals(CLOSED.text)) {
      return CLOSED;
    }
    else if (string.equals(OPEN.text)) {
      return OPEN;
    }
    else if (string.contains(CLOSED_TECHNICAL.text)) {
      return CLOSED_TECHNICAL;
    }
    else if (string.contains(CLOSED_BAD_WEATHER.text)) {
      return CLOSED_BAD_WEATHER;
    }
    else if (string.contains(CLOSED_AVALANCHE.text)) {
      return CLOSED_AVALANCHE;
    }
    else if (string.contains(OPEN_OPTIMAL.text)) {
      return OPEN_OPTIMAL;
    }
    else if (string.contains(OPEN_GOOD.text)) {
      return OPEN_GOOD;
    }
    else if (string.contains(OPEN_ACCEPTABLE.text)) {
      return OPEN_ACCEPTABLE;
    }
    else if (string.contains(OPEN_DIFFICULT.text)) {
      return OPEN_DIFFICULT;
    }
    return CLOSED;
  }

}
